<?php
//数据库参数
$servername = "localhost";
$usermysqlname = "root1";
$passwordmysql = "123456";
$users = "users";
//获取账号密码
$username = $_POST["username"];
$password = $_POST["password"];
// 设置编码，防止中文乱码
mysqli_query($conn , "set names utf8");
//连接数据库
$conn = new mysqli($servername,$usermysqlname,$passwordmysql,$users);


//检测连接
if($conn->connet_error){
    die("连接失败:". $conn->connect_error);
}
//
$username = $conn->real_escape_string($username);
$password = $conn->real_escape_string($password);


$sql = "SELECT * FROM users WHERE usernmae = '$username' AND password = '$password'";


if ($conn->query($sql) ===true) {
    echo"<script>
    window.location.href = 'message.html';
</script>";
}
else{
    echo"<script>
    alert('用户名或密码错误！');
    window.location.href = 'higherlogin.html';
</script>";
}

$conn->close();


?>